<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>记事本案例</title>
		<script src="../../vue/vue.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			#app{
				width: 400px;
				height: 400px;
				background-color: antiquewhite;
				margin: 0 auto;
			}
			h2{
				text-align: center;
			}
			input{
				width: 396px;
			}
			li{
				list-style: none;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<h2>小黑记事本</h2>
			<input type="text"  id="input" v-model="datas" placeholder="请输入内容"/>
			
			<ul v-for="(item,index) in list" @keyup.enter="add()">
				
				<li>{{index+1}}  {{item}}</li>
				<button type="button" id="btn" @click="dj()">x</button>
				
			</ul>
		</div>
		<script type="text/javascript">
			var app = new Vue({
				el:'#app',
				data:{
					list:['睡觉觉','吃饭饭','写代码'],
					datas:''
				},
				methods:{
					add:function(){
						this.list.push(this.datas);
						
					},
					remove:function(){
						
					},
					dj:function(){//删除内容
						this.list.splice(this.index,1);
					},
					
					
				}
			});
			
		</script>
	</body>
</html>
